<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/padrao.xhtml">
	<ui:define name="content">
		<h:form id="formRotinaHome">
			<p:messages id="messages" autoUpdate="true" closable="true"  />  
			<p:panel header="Cadastro de Rotinas" style="whidt:100%;">
				<h:panelGrid columns="3" id="painel" width="100%">

					<h:outputText value="Nome"/>
					<p:inputText id="rotinaNome" size="60"
						value="#{rotinaHome.rotina.nome}" title="informe o nome do rotina" 
						required="true" requiredMessage="a rotina deve ser informada"
						label="a rotina deve ser informado" maxlength="100"
						style="width:400px;" />
						<p:tooltip for="rotinaNome" showEvent="focus" hideEvent="blur" />

					<h:outputText value="Path"/>
					<p:inputText id="rotinaPath" size="60"
						value="#{rotinaHome.rotina.path}" title="informe o nome do path" 
						required="true" requiredMessage="o path deve ser informada"
						label="o paht deve ser informado" maxlength="100"
						style="width:400px;" />
						<p:tooltip for="rotinaPath" showEvent="focus" hideEvent="blur" />

					<h:outputText value="Ativa" />
					<p:selectBooleanCheckbox value="#{rotinaHome.rotina.status}" />					

				</h:panelGrid>
			</p:panel>

			
					<p:commandButton value="Salvar" action="#{rotinaHome.save}"
						update="painelLista,painel" />
						
					<p:commandButton value="Novo" icon="ui-icon-document"
							action="#{rotinaHome.clean()}" update="painel"
							immediate="true" />
				
				<p:dataTable var="listRotinas" id="painelLista"
					value="#{rotinaHome.rotinas}" paginator="true" rows="5"
					style="max-width: 100%; min-width: 100%"
					emptyMessage="Nenhum registro.">

					<p:column style="max-width: 10%; min-width: 10%; ">
					<f:facet name="header" width="10%">
							<h:outputText value="Codigo" />
						</f:facet>
						<h:outputText value="#{listRotinas.id}" />
					</p:column>

					<p:column
						style="max-width: 450px; min-width: 450px; overflow: hidden">
						<f:facet name="header">
							<h:outputText value="Nome" width="95%" />
						</f:facet>
						<h:outputText value="#{listRotinas.nome}" />
					</p:column>

					<p:column width="15%">
						<p:commandButton title="Editar" update="painel" immediate="true"
							action="#{rotinaHome.edit}" ajax="false"
							icon="ui-icon-folder-open">
							<f:setPropertyActionListener target="#{rotinaHome.selected}"
								value="#{listRotinas}" />
						</p:commandButton>
					</p:column>

					<p:column width="15%">
						<p:commandButton title="Excluir" update="painel" immediate="true"
							action="#{rotinaHome.remove}" ajax="false"
							icon="ui-icon-trash">
							<f:setPropertyActionListener target="#{rotinaHome.selected}"
								value="#{listRotinas}" />
						</p:commandButton>
					</p:column>

				</p:dataTable>

		</h:form>

	</ui:define>
</ui:composition>
